<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>จัดการข้อมูลนักศึกษา</title>

<style type="text/css">
.body {
}

#boxcenter{
	height: auto;
	width: 760px;
	background-color: #444041;
}
body,td,th {
	color: #FFF;
}
</style>
</head>
<body>

<div id="boxcenter">
  <form action="" method="post" enctype="multipart/form-data" name="" id="">
<table width="100%" border="0" cellpadding="1" cellspacing="1">
  
  <tr class="txt_td">
    <th width="15%" height="25"  background="images/img/had.png">ลำดับ</th>
    <th width="65%" height="25"  background="images/img/had.png">ชื่อ - นามสกุล</th>
    <th width="20%" height="25"  background="images/img/had.png">จัดการข้อมูล</th>
  </tr>
<?
   $sql_m = "select * from tb_student order by student_id asc";
   $result_m = $dbfunc->query($sql_m);
   
   $j=1;
      while( $fetch_m= mysql_fetch_object($result_m)){
?>   
  <tr>
    <td align="center" bgcolor="#999999"><? echo $j++?></td>
    <td align="center" bgcolor="#999999"><? echo $fetch_m->student_name."&nbsp; &nbsp;".$fetch_m->student_surname ;?></td>
    <td align="center" bgcolor="#999999">
    <a href="?module=admin&page=edit_student&m=<?=$fetch_m->student_id;?>">
    <img src="images/edit.png" width="15" height="15" border="0" /></a>
    <a href="?module=admin&page=del_student&m=<?=$fetch_m->student_id;?>">
     <img src="images/delete.png" width="15" height="15" border="0" /></a>
     <a student_id="<?php echo $fetch_m->student_id; ?>" class="show-button" style="cursor:pointer;">
     <img src="images/see_icon.jpg" width="15" height="15" border="0" /></a>
     </td>
  </tr>
<? }?> 
</table>
    <table width="100%" border="0" cellspacing="1" cellpadding="1">
      <tr>
        <th width="85%" scope="col">&nbsp;</th>
        <th width="15%" bgcolor="#999999" ><a href="?module=admin&page=frm_student" class="body">เพิ่มข้อมูล</a></span>
        </a></p></th>
      </tr>
    </table>
</form >
  
 
  
</div>
    
    
<style>
#popup-block{
	width: 900px;
	height: 500px;
	background: black;
	margin: 20px auto;
	opacity: 1;
	display: none;
	position: fixed; top: 10px; left:18%;
	z-index: 1001;
	border-radius: 15px;
        -moz-border-radius-topright: 15px;
        -webkit-border-top-right-radius: 15px;
	padding: 25px;
	border: #FFF solid 6px;
}
#popup-block ul{
        margin: 10px;
        color: green;
}
#popup-block h4#stu-name{
        color: red;
        margin-bottom: 10px;
        font-weight: bolder;
}
#loading{
	background: url(images/loading.gif);
	z-index: 1000;
	position: fixed; top: 50%; left: 50%;
	display: none;
	width: 16px;
	height: 16px;
}
.close{
	background: url(images/close_icon.png);
	position: absolute; bottom: -20px; right: -30px;
	width: 45px; height: 45px;
	z-index: 10000;
	cursor: pointer;
	opacity: 1;
}
.close:hover{
	opacity: 0.8;
}
</style>
<div id="popup-block">
    <span class="close"></span>
    <div>
        <h4 id="stu-name"></h4>
        <h4>รายวิชาที่ลงทะเบียนเรียนตามแผนการเรียน</h4>
        <ul id="plan">
            
        </ul>
        <h4>รายวิชาที่ลงทะเบียนเรียนนอกแผนการเรียน</h4>
        <ul id="regis">
            
        </ul>
    </div>
</div>
<div id="back_popup" style="display:none; width:100%; height: 100%; position: fixed; top: 0px; left: 0px; background:black; opacity:0.68; z-index:999;"></div>
<script>
$(document).ready(function(){
    $('.show-button').click(function(){
        $('#back_popup').fadeIn();
        $('#popup-block').fadeIn();
        $('#plan').html('');
        $('#regis').html('');
        var student_id = $(this).attr('student_id');
        var i;
        $.ajax("ajax.php",{
            data:{
                student_id: student_id,
                module: 'admin',
                page: 'ajax_get_plan-regis'
            },
            type: 'GET',
            dataType: 'json',
            success: function(data){
                if(data.student){
                    $('#stu-name').html(data.student.student_name+' '+data.student.student_surname);
                }
                if(data.plan){
                    for(i=0;i<data.plan.length;i++){
                        $('#plan').append('<li>'+'วิชา '+data.plan[i].subject_name+' : '+data.plan[i].sec_des+' ผู้สอน '+data.plan[i].teacher_name+' '+data.plan[i].teacher_surname+'</li>');
                    }
                }
                if(data.reg){
                    for(i=0;i<data.reg.length;i++){
                        $('#regis').append('<li>'+'วิชา '+data.reg[i].subject_name+' : '+data.reg[i].sec_des+' ผู้สอน '+data.reg[i].teacher_name+' '+data.reg[i].teacher_surname+'</li>');
                    }
                }
            }
        });
    });

    $('.close').click(function(){
            $("#back_popup,#popup-block").fadeOut();
    });
    $(window.document).keyup(function(e){
            if(e.keyCode==27){
                    $('.close').click();
            }
    });
});
</script>
</body>
</html>